import {Injectable} from '@angular/core';
import {MessageService} from '../message/message.service';

/*写完后需要在appMoudle Prodivers中引入*/
@Injectable({
  providedIn: 'root'
}) /*装饰器表示其它服务可注入*/
export class ProductService {

  constructor(public message: MessageService) {
  }

  getProduct(): Product {
    this.message.log('This is a product message !');
    return new Product(1, 'iphone max', 1223, 'This is a Apple phone !');
  }

  getPack(): void {

  }

}

export class Product {
  constructor(
    public id: number,
    public title: string,
    public price: number,
    public desc: string
  ) {
  }
}
